#include "paintscene.h"

#include "toolsmanager.h"
#include "paintview.h"

PaintScene::PaintScene(qreal x, qreal y, qreal width, qreal height, QObject *parent) :
        QGraphicsScene(x, y, width, height, parent)
{

}

PaintScene::~PaintScene()
{

}

void PaintScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    PaintTool *tool = ToolsManager::instance()->selectedTool();

    if(tool)
    {
        tool->mousePressed(event);
    }
}

void PaintScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    PaintTool *tool = ToolsManager::instance()->selectedTool();

    if(tool)
    {
        tool->mouseMoved(event);
    }
}

void PaintScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
    PaintTool *tool = ToolsManager::instance()->selectedTool();

    if(tool)
    {
        tool->mouseReleased(event);
    }
}
